package main

// 递归版本
func Factorial_1(n, i int) int {
	switch {
	case n == 0:
		return 0
	case n == 1:
		return i
	}

	return Factorial_1(n-1, i*n)
}

// 循环版本
func Factorial_2(n int) int {
	result := 1
	for i := 2; i <= n; i++ {
		result *= i
	}
	return result
}
